<?php

function calc_savings ($spend_per_week, $initial_smoke_per_day, $current_smoke_per_day, $days_active) {
	return ($initial_smoke_per_day - $current_smoke_per_day) * ($spend_per_week / 7 / $initial_smoke_per_day) * $days_active;
}

function calc_savings_percentage ($savings, $savings_goal) {
	if ($savings <= 0) return 0;
	else return $savings / $savings_goal * 100;
}

?>
